package com.rasou.jdk;

import java.lang.reflect.Proxy;

public class JDKInterceptorEnhancer {
    public Object enhance(Object target, Class<?> clazz, Object... interceptors) {
        ClassLoader classLoader =Thread.currentThread().getContextClassLoader();
        MyInvocationHandler invocationHandler = new MyInvocationHandler(target, interceptors);
        return Proxy.newProxyInstance(classLoader, new Class[]{clazz}, invocationHandler);
    }
}
